import "@/plugins/z-dragxml/components/ZDragLoop/index.scss"
import {createZDragLoopDef} from "@/plugins/z-dragxml/components/ZDragLoop";

let def = createZDragLoopDef(
  {
    entiels: [
      ['对象', 'obj'],
      ['数组对象', 'arrayObj'],
      ['GRID', 'grid'],
    ],
    resolveData(data) {
      data.INIT_CONFIG= {
        ui: {
          defType: 'arrayObj'
        }
      }
      console.log('data', data)
      return data
    }
  },
)
def.name = "ZDragSLoop"
def.template = `
  <div class="z-dragxml-com z-drag-loop " :class="{['z-dragxml-loop--table']: widgetMode === 'table'}"
  no-drag-line
  @dragenter.prevent.stop="onDragEnter"
  @mouseenter.stop="onMouseEnter"
  :z-drag-loop-uuid="uuid"
  >
  <!--    {{uuid}}-->
<!--      {{ui_config_editor}}-->
  <!--    <div>{{FIND_ARR_TYPE('level' + level)}}</div>-->
  <div style="color: var(--el-color-primary)">{{FIND_ARR_TYPE('未定义类型')}}</div>
  <div class="z-dragxml-loop__con">

    <!--    <z-drag-loop v-if="level < 1" :level="level + 1"></z-drag-loop>-->
    <div :id="zdrag_loop__genId(startUUID)" class="z-dragxml-loop__start"
    @dragenter.stop="zdrag_loop__onDragEnterStart(startUUID, $event)"
    >&nbsp;</div>
  <!--    {{widgets}}-->
  <div :id="zdrag_loop__genId(widget[0])" class="z-dragxml-loop__item"
  v-for="widget in widgets" :key="widget[0]"
  @dragenter.stop="zdrag_loop__onDragEnter(widget, $event)"

  >
  <!--      {{widget}}-->
  <component
  :is="widget[0]" :ref="widget[0]" v-if="widget && widget[0]"></component>
</div>
<div :id="zdrag_loop__genId(endUUID)" class="z-dragxml-loop__end"
@dragenter.stop="zdrag_loop__onDragEnterEnd(endUUID, $event)"
@dragleave.stop="zdrag_loop__onDragLeaveEnd"
  >&nbsp;</div>

</div>
<div class="z-drag-loop__append"
     v-if="ui_config_editor && ui_config_editor.ins && ui_config_editor.ins.ui && ui_config_editor.ins.ui.defType === 'arrayObj'"
>
  <el-space>
    <el-button>新增一项</el-button>
  </el-space>
</div>
</div>

  `
def.DRAG_GROUP =  'custom'
def.DRAG_LABEL_XML = function () {
  return `<div class="z-dragxml-row">
<svg t="1644385766851" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4491" width="16" height="16"><path d="M372.622 746.667c-105.244 0-192-86.756-192-192s86.756-192 192-192c36.978 0 72.534 9.955 103.822 29.866 12.8 8.534 17.067 25.6 8.534 39.823-8.534 12.8-25.6 17.066-39.822 8.533-21.334-14.222-46.934-21.333-72.534-21.333-73.955 0-135.11 61.155-135.11 135.11s61.155 135.112 135.11 135.112 135.111-61.156 135.111-135.111c0-15.645 12.8-28.445 28.445-28.445s28.444 12.8 28.444 28.445c0 105.244-86.755 192-192 192z" p-id="4492"></path><path d="M699.733 746.667c-39.822 0-78.222-11.378-109.51-34.134-12.8-8.533-15.645-27.022-7.112-39.822 8.533-12.8 27.022-15.644 39.822-7.111 22.756 15.644 49.778 24.178 76.8 24.178 73.956 0 135.111-61.156 135.111-135.111s-61.155-135.111-135.11-135.111-135.112 61.155-135.112 135.11c0 15.645-12.8 28.445-28.444 28.445s-28.445-12.8-28.445-28.444c0-105.245 86.756-192 192-192s192 85.333 192 192c0 105.244-86.755 192-192 192z" p-id="4493"></path></svg>
<div class="z-dragxml-label__name">s无限层</div>
</div>`
}
export default def

